package 牛客周赛.牛客周赛Round39;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @Title: B小红不想做鸽巢原理
 * @Author 贾金博
 * @Package 牛客周赛.牛客周赛Round39
 * @Date 2024/4/8 21:11
 * @description:
 */
public class B小红不想做鸽巢原理 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, k;
        n = sc.nextInt();
        k = sc.nextInt();

        long[] a = new long[n];
        long sum = 0;

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
            sum += a[i];
        }
        Arrays.sort(a);
        long t = sum % k; // 剩下来的球
        //注意 别忘特判
        if(t == 0) {
            System.out.println(0);
            return;
        }
        long ret = 0;
        for(int i = n - 1; i >= 0; -- i ) {
            t -= a[i];
            ret ++ ;
            if(t <= 0) {
                break;
            }
        }
        System.out.println(ret);
    }
}
